package mest.util;


import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;


public class DateUtil {


    /**
     * 获取现在时间(字符串类型)
     */
    public static String getDateTimeToString() throws ParseException {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return sdf.format(new Date());
    }

    /**
     * 获取现在时间(Date类型)
     */
    public static Date getDateTimeToDate() throws ParseException {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String newDate = sdf.format(new Date());
        return sdf.parse(newDate);
    }


    public static void main(String[] args) throws ParseException {

    }
}
